using System;
using System.Collections.Generic;
using System.Text;

namespace TTDotNet.Engine.Vehicles
{

    public class OrderList
    {
        List<Order> allOrders;

        public OrderList()
        {
            allOrders = new List<Order>();
        }

        public void AddOrder(Order o)
        {
            allOrders.Add(o);
        }

        public void AddOrderAt(Order o, int place)
        {
            allOrders.Insert(place, o);
            throw new Exception();
        }

        public Order GetOrder(int num)
        {
            return allOrders[num];
        }

        public int NextOrderNumber(int num)
        {
            if (allOrders.Count > 0)
            {
                return (num + 1) % allOrders.Count;
            }
            else
            {
                return -1;
            }
        }

        public int Count
        {
            get { return allOrders.Count; }
        }

        public IEnumerator<Order> GetEnumerator()
        {
            foreach (Order o in allOrders)
            {
                yield return o;
            }
        }

    }
}
